<template>
	<!-- #ifdef APP-PLUS -->
	<view style=";margin-bottom: 88px;">
	<!-- #endif -->
	<!-- #ifdef H5 -->
	<view style="margin-bottom: 44px;">
	<!-- #endif -->
			<u-navbar :title="title2 && title2 || title" @rightClick="rightClick" @leftClick="()=>{}" >
				<template slot="left">
					<view class="left" v-if="showGoBack" @click="goBack">
						<image class="img" style="position: relative;bottom: 18rpx;"
							src="/static/image/universal/arrows.png" mode=""></image>
					</view>
				</template>
				<template slot="center">
					<slot name="center">
						<view class="title-box">
							<view class="main-title">
							{{title||' '}}
							<view class="idot" v-if="num > 0">{{  num }}</view>
							</view>
							
							<view class="sub-title" v-if="title2">{{title2}}</view>
						</view>
					</slot>
				</template>
				<template slot="right">
					<slot></slot>
				</template>
			</u-navbar>
	</view>
</template>

<script>
	export default {
		name: "navBar",
		props: {
			title: String,
			title2: String,
			goBackUrl: String,
			num:{
				type:String,
				default:'',
			},
			goBackStatus: {
				default: false,
				type: Boolean
			},
			showGoBack: {
				default: true,
				type: Boolean
			}
		},
		methods: {
			rightClick() {

			},
			goBack() {
				if (this.goBackStatus || this.goBackUrl) {
					this.$emit("goBack", this.goBackUrl)
				} else {
					uni.navigateBack()
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.navBar {
		width: 100%;
		height: 130rpx;
		line-height: 88rpx;
		padding: 14rpx 20rpx;
		margin-top: 35rpx;
		box-sizing: border-box;
		background-color: #fff;
		position: relative;
		overflow: hidden;
	}

	.left {
		position: absolute;
		left: 30rpx;
		top: 34rpx;
		font-size: 0;

		.img {
			width: 60rpx;
			height: 60rpx;
		}
	}

	.title-box {
		width: 100%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;

		.main-title {
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: 600;
			line-height: 50rpx;
			color: #22204E;
			text-align: center;
			display: flex;
			.idot {
				text-align: center;
				line-height: 40rpx;
				width: 40rpx;
				height: 40rpx;
				border-radius: 50%;
				background: #ff6a6a;
				color: white;
				font-size: 16px;
			}
		}

		.sub-title {
			font-size: 24rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			color: #4F5E7B;
			line-height: 36rpx;
			text-align: center;
		}
	}

	.right {
		position: absolute;
		right: 0;
		top: 12rpx;
		height: 106rpx;
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}
</style>
